<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Serialize variables into a WDDX packet</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.wddx-serialize-value.html">« wddx_serialize_value</a></li>
      <li style="float: right;"><a href="book.xmldiff.html">XMLDiff »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.wddx.html">WDDX 函数</a></li>
    <li>Serialize variables into a WDDX packet</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.wddx-serialize-vars" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">wddx_serialize_vars</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">wddx_serialize_vars</span> &mdash; <span class="dc-title">Serialize variables into a WDDX packet</span></p>

 </div>
 
 <div id="function.wddx-serialize-vars-refsynopsisdiv">
  <div class="warning"><strong class="warning">警告</strong><p class="simpara">该函数已在 PHP 7.4.0 中
<em class="emphasis">移除</em>。</p></div>
 </div>

 <div class="refsect1 description" id="refsect1-function.wddx-serialize-vars-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>wddx_serialize_vars</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$var_name</code></span>, <span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">...$var_names</code></span>): <span class="type">string</span></div>

  <p class="para rdfs-comment">
   Creates a WDDX packet with a structure that contains the serialized
   representation of the passed variables.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.wddx-serialize-vars-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   This function takes a variable number of parameters.
   <dl>
    
     <dt>
<code class="parameter">var_name</code></dt>

     <dd>

      <p class="para">
       Can be either a string naming a variable or an array containing
       strings naming the variables or another array, etc.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">var_names</code></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.wddx-serialize-vars-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the WDDX packet, or <strong><code>false</code></strong> on error.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.wddx-serialize-vars-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5478">
    <p><strong>示例 #1 <span class="function"><strong>wddx_serialize_vars()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$a&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$b&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">5.5</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">"blue"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"orange"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"violet"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$d&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"colors"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$clvars&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">"c"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"d"</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">wddx_serialize_vars</span><span style="color: #007700">(</span><span style="color: #DD0000">"a"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"b"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$clvars</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
&lt;wddxPacket version=&#039;1.0&#039;&gt;&lt;header/&gt;&lt;data&gt;&lt;struct&gt;&lt;var name=&#039;a&#039;&gt;&lt;number&gt;1&lt;/number&gt;&lt;/var&gt;
&lt;var name=&#039;b&#039;&gt;&lt;number&gt;5.5&lt;/number&gt;&lt;/var&gt;&lt;var name=&#039;c&#039;&gt;&lt;array length=&#039;3&#039;&gt;
&lt;string&gt;blue&lt;/string&gt;&lt;string&gt;orange&lt;/string&gt;&lt;string&gt;violet&lt;/string&gt;&lt;/array&gt;&lt;/var&gt;
&lt;var name=&#039;d&#039;&gt;&lt;string&gt;colors&lt;/string&gt;&lt;/var&gt;&lt;/struct&gt;&lt;/data&gt;&lt;/wddxPacket&gt;
</pre></div>
    </div>
   </div>
  </p>
 </div>

</div></div></div></body></html>